﻿using Android.App;
using Android.Content.PM;
using Android.OS;
using Com.Amap.Api.Maps2d;
using Java.Lang;

namespace JWXH.XH.Droid.pages
{
    [Activity(Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = false, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class GaodeMapActivety : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {
        MapView mMapView = null;
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.GaodeMap);
            //获取地图控件引用
            mMapView = (MapView)FindViewById(Resource.Id.map);
            //在activity执行onCreate时执行mMapView.onCreate(savedInstanceState)，创建地图
            mMapView.OnCreate(bundle);
        }
        protected override void OnDestroy()
        {
            base.OnDestroy();
            //在activity执行onDestroy时执行mMapView.onDestroy()，销毁地图
            mMapView.OnDestroy();
        }
        protected override void OnResume()
        {
            base.OnResume();
            //在activity执行onResume时执行mMapView.onResume ()，重新绘制加载地图
            mMapView.OnResume();
        }
        protected override void OnPause()
        {
            base.OnPause();
            //在activity执行onPause时执行mMapView.onPause ()，暂停地图的绘制
            mMapView.OnPause();
        }
        protected override void OnSaveInstanceState(Bundle outState)
        {
            base.OnSaveInstanceState(outState);
            //在activity执行onSaveInstanceState时执行mMapView.onSaveInstanceState (outState)，保存地图当前的状态
            mMapView.OnSaveInstanceState(outState);
        }
    }
}